﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jungle.Rent;
using Jungle.Code.Core;
using Jungle.Code.Utils;

using Jungle.Users;

public partial class AddEditOffer : System.Web.UI.UserControl
{
    SessionKeeper sk = new SessionKeeper();
    //------------------------------------------------------------------------------------------------------
    protected override void OnInit(EventArgs e)
    {
        sk.SessionId = Session.SessionID;
        sk.GetData();

        LoadLinks();

        if (sk.UserId == -1) this.Controls.Clear();
        else
        switch (Request["cmd"])
        {
            case "Add": 
                mv_Offers.ActiveViewIndex = 0;
                if (new UserManager(sk.UserId).RoleId == 6) mv_Offers.ActiveViewIndex = 1;
                break;
        }


        base.OnInit(e);
    }
    // ----------------------------------------------------------------------------------------------------
    private void LoadLinks()
    {
        hp_AddOffer_Hands.NavigateUrl = UrlHelper.GetSiteUrl() + "/ru/offers.aspx?cmd=addH";
        hp_AddOffer_Auto.NavigateUrl = UrlHelper.GetSiteUrl() + "/ru/offers.aspx?cmd=addA";
    }
}
